<?php


namespace catchAdmin\settlement\model\search;


trait BillSearch
{
    //开票公司搜索
    public function searchBillingCompanyAttr($query,$value,$data)
    {
        return $query->whereLike('billing_company','%'.$value.'%');
    }

    //结算单位搜索
    public function searchSettlementUnitAttr($query,$value,$data)
    {
        return $query->whereLike('settlement_unit','%'.$value.'%');
    }

    //账单类型搜索
    public function searchBillTypeAttr($query,$value,$data)
    {
        return $query->whereLike('bill_type','%'.$value.'%');
    }

    //业务类型搜索
    public function searchBusinessTypeAttr($query,$value,$data)
    {
        return $query->whereLike('business_type','%'.$value.'%');
    }

    //币种搜索
    public function searchCurrencyAttr($query,$value,$data)
    {
        return $query->whereLike('currency','%'.$value.'%');
    }

    //账单号搜索
    public function searchBillNumAttr($query,$value,$data)
    {
        return $query->whereLike('bill_num','%'.$value.'%');
    }

    //账单完成搜索
    public function searchIsBillOkAttr($query,$value,$data)
    {
        return $query->whereLike('is_bill_ok','%'.$value.'%');
    }

    //账单金额搜索
    public function searchBillMoneyAttr($query,$value,$data)
    {
        return $query->whereLike('bill_money','%'.$value.'%');
    }

    //工作号搜索
    public function searchJobNumberAttr($query,$value,$data)
    {
        return $query->whereLike('job_number','%'.$value.'%');
    }

    //通知开票搜索
    public function searchIsNoticeInvoicingAttr($query,$value,$data)
    {
        return $query->whereLike('is_notice_invoicing','%'.$value.'%');
    }

    //开票完成搜索
    public function searchIsBillingCompletedAttr($query,$value,$data)
    {
        return $query->whereLike('is_billing_completed','%'.$value.'%');
    }

    //发票号搜索
    public function searchInvoiceNumAttr($query,$value,$data)
    {
        return $query->whereLike('invoice_num','%'.$value.'%');
    }

    //账单标识搜索
    public function searchBillIdentificationAttr($query,$value,$data)
    {
        return $query->whereLike('bill_identification','%'.$value.'%');
    }

    //创建日期(开始日期，结束日期)搜索
    public function searchCreatedAtAttr($query,$value,$data)
    {
        //$time=explode(',',$value);
        return $query->whereBetweenTime('created_at',strtotime($value[0]),strtotime($value[1]));
    }
}